#ifndef TESTABLE_ENGINE_H
#define TESTABLE_ENGINE_H

#include "engine.h"
#include "file.h"
#include <string>
#include <map>

namespace VERGE1 {

    typedef std::map<std::string, File*> mock_file_list_t;
    
    class TestableEngine
    : public Engine {
        mock_file_list_t mock_file_list;
        
        File* find_mock_file(const char* filename);
        bool is_read_mode(const char* mode);
        bool is_write_mode(const char* mode);
        void validate_file(File* file);
    
    public:
        File* fopen(const char* filename, const char* mode);
        int fclose(File*& file);
        int fscanf(File* file, const char* format, ...);
        char* fgets(char* s, int n, File* file);
        int fwrite(const void* p, int size, int count, File* file);
        int remove(const char* filename);
    };
    
    extern TestableEngine testable_engine;
    
}

#endif
